<template>
	<view>
		<view class="details" v-if="type == 1">
			<view class="details_share">
				<view class="qrcode_box">
					<uqrcode ref="uqrcode" canvas-id="qrcode" :value="value" @complete="complete" :size="190">
					</uqrcode>
				</view>
			</view>
		</view>
		<view class="details_box" v-if="type == 2">
			<text class="cont" v-if="data.about && data.about.content != ''" v-html="data.about.content"></text>
			<u-empty v-else mode="data" icon="../../../../static/Empty/data_null.png">
			</u-empty>
		</view>
	</view>
</template>

<script>
	var util = require('@/util/request5.js');
	export default {
		data() {
			return {
				value: '',
				type: null,
				userinfo: {},
				data: {},
				enumber: '',
			}
		},
		onLoad(e) {
			this.userinfo = uni.getStorageSync('userinfo')
			this.enumber = uni.getStorageSync('equipment_number')
			this.type = e.id
			uni.setNavigationBarTitle({
				title: e.name
			})
			this.value = util.WEB_URL + '/pages/register/index?enumber=' + this.enumber + '&userid=' + this.userinfo.id
			this._agreeon()
		},
		methods: {
			complete() {
				this.$refs.uqrcode.toTempFilePath({
					success: res => {
					}
				});
			},
			async _agreeon() {
				uni.showLoading({
					title: '加载中'
				});
				const userinfo = uni.getStorageSync('userinfo');
				const {
					data: res
				} = await this.$myHttp5({
					url: 'v1/getContent',
					data: {},
					header: {
						'token': userinfo.token
					}
				});
				uni.hideLoading()
				if (res.code == 1) {
					this.data = res.data
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.details_box {
		padding: 50rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.tit {
			font-size: 36rpx;
			padding-bottom: 15rpx;
			display: block;
		}

		.cont {
			font-size: 28rpx;
			color: #333333;
			display: block;
			margin-top: 20rpx;
		}
	}

	.details {
		padding: 50rpx;
		min-height: 94vh;
		height: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: center;
		background: url('@/static/share_bg.jpg') no-repeat center;
		background-size: 100% 100%;
		.details_share{
			margin-top: 440rpx;
			
			.qrcode_box {
				background-color: #fff;
				padding: 10rpx;
			}
		}
	}
</style>